package com.car.util;

import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;
/**
 * ibatis操作数据库（存emoji表情时用）
 * @author hq
 *
 */
public class IbatisInit {
	private static SqlMapClient sqlClient = null;
	
	static  {
		try {
//			 String path = Config.class.getClassLoader().getResource("").getPath();
		     String config = "dal/ibatis-sqlmapconfig.xml";  
		     Reader reader = Resources.getResourceAsReader(config);  
		     sqlClient = SqlMapClientBuilder.buildSqlMapClient(reader);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static SqlMapClient getSqlClient(){
		return sqlClient;
	}
}
